<template>
  <view>
    <!-- 生产环境 -->
    <view v-if="(environment != 'production')" class="developmentMain">
      <view class="logoBox">
        <image src="../../static/images/logoImg.png" mode="widthFix"></image>
        <view class="name">
          uniApp开发模板
          <text>V1.0.0</text>
        </view>
        <text class="tip">测试版</text>
      </view>
      <button @click="jumpPage" class="goToAppBtn">进入应用</button>
      <text class="subTip">测试版本仅用于开发调试</text>
    </view>
    <!-- 正式环境 -->
    <view
      v-if="environment == 'production'"
      class="startMain flex align-center justify-center"
    >
      <image src="../../static/images/loadding.gif" mode="widthFix"></image>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      environment: '',
    }
  },
  onLoad() {
    let environment = process.env.NODE_ENV
    this.environment = environment
    if (environment == 'production') {
      setTimeout(() => {
        this.jumpPage()
      }, 1200)
    }
  },
  methods: {
    jumpPage() {
      this.$u.route({
        url: '/pages/index/index',
        type: 'navigateTo',
      })
    },
  },
}
</script>

<style lang="scss">
.startMain {
  background: #fff;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  image {
    width: 160rpx;
    height: 160rpx;
    display: block;
  }
}
.developmentMain {
  background: #fff;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  .logoBox {
    padding-top: 35%;
    image {
      width: 160rpx;
      height: 160rpx;
      display: block;
      margin: 0 auto;
    }
    .name {
      padding-top: 30rpx;
      font-size: 50rpx;
      font-weight: bold;
      text-align: center;
      text {
        font-size: 28rpx;
        padding-left: 10rpx;
      }
    }
    .tip {
      font-size: 28rpx;
      color: #fb4535;
      font-weight: bold;
      padding-top: 20rpx;
      display: block;
      text-align: center;
    }
  }
  button {
    width: 300rpx;
    height: 70rpx;
    line-height: 70rpx;
    font-size: 32rpx;
    color: #fff;
    background: $app-color-main;
    position: fixed;
    bottom: 300rpx;
    left: 50%;
    margin-left: -150rpx;
  }
  .subTip {
    position: fixed;
    display: block;
    left: 0;
    bottom: 220rpx;
    line-height: 80rpx;
    text-align: center;
    width: 100%;
  }
}
.noNetworkMain {
  background: #fff;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  .noNetworkBox {
    margin-top: -200rpx;
    image {
      width: 350rpx;
      height: 350rpx;
      display: block;
      margin: 0 auto;
    }
    text {
      display: block;
      font-size: 28rpx;
      color: #333;
      text-align: center;
    }
  }
}
</style>
